<?PHP
include_once "ini.php";
include "url.php";
dbconnect();


$sql = "SELECT * FROM images WHERE droit = 'public' AND posted = 'oui';";
$req = mysql_query($sql);

if (!$req)
{
    echo "SQL error : ", $sql;
    exit ;
}
else
{
    $file = "../imagePublic.txt";
    $fp = fopen($file, "w");

    while ($tab = mysql_fetch_assoc($req))
    {
		print_r($tab);
        $ligne = $tab['coord_x'].",".$tab['coord_y'].",".$tab['coord_z']."	".$tab['orientation_dir']."	".$tab['orientation_up']."	".$tab['nom_image']."	".$url."images/".$tab['nom_image']."	".$tab['id_image']."\n";
        fputs($fp, $ligne);
    }
    fclose($fp);
}

$file = "../imagePrive.txt";
$fp2 = fopen($file, "w");
fputs($fp2, "");
fclose($fp2);
dbclose();
?>